package com.ticket.sass.common.exception.enums

/**
 * @ClassName : ErrorCode
 * @Description : 错误编码
 * @Author : wwg
 * @Date: 2021-12-23 13:55
 */
enum class ErrorCode(val value: String, val series: Series, val reasonPhrase: String) {

    OK("", Series.OK, "OK"),

    // A系列（表示错误来源于用户）
    CLIENT_ERROR("A0100", Series.CLIENT, "用户端出错"),
    UNAUTHORIZED("A0101", Series.CLIENT, "管理员未登录"),
    USER_AUTH_FAIL("A0102", Series.CLIENT, "TOKEN有误"),

    BAD_REQUEST("A0201", Series.CLIENT, "请求参数有误"),
    INPUT_REQUEST("A0202", Series.CLIENT, "输入数据有误"),
    RECORD_NOT_EXIST("A0203", Series.CLIENT, "记录不存在"),
    RECORD_EXIST("A0204", Series.CLIENT, "记录已存在"),
    REQUEST_ORDER("A0205", Series.CLIENT, "请求顺序有误"),

    PASSWORD_INPUT_ERROR("A0302", Series.CLIENT, "密码输入错误"),
    LOGIN_PARAMS_ERROR("A0303", Series.CLIENT, "账号或密码输入错误，登录失败"),

    BUSINESS_ERROR("A0401", Series.CLIENT, "业务错误"),

    // B系列（表示错误来源于当前系统）
    SERVER_ERROR("B0100", Series.SERVER, "系统执行出错"),

    SQL_ERROR("B0200", Series.SERVER, "数据库执行出错"),
    SQL_DATA_ERROR("B0201", Series.SERVER, "数据库数据异常，疑似脏数据！"),

    CONFIG_ERROR("B0300", Series.SERVER, "配置出错"),
    HTTP_TYPE_ERROR("B0301", Series.SERVER, "HTTP请求参数类型出错"),
    CONCURRENT_ERROR("B0302", Series.SERVER, "并发异常"),

    PERMISSION_ERROR("B0401", Series.CLIENT, "无访问权限"),
    FORBIDDEN("B0403", Series.SERVER, "禁止访问"),
    NO_PATH("B0404", Series.SERVER, "没有该路径"),

    // C系列（表示错误来源于第三方服务）
    WX_ERROR("C0100", Series.PLATFORM, "微信交互异常"),
    CORE_ERROR("C0200", Series.PLATFORM, "核心服务异常"),
    TICKET_SERVICE_ERROR("C0500", Series.PLATFORM, "检票服务异常"),
    MQTT_ERROR("C0300", Series.PLATFORM, "消息推送服务异常"),
    SMS_ERROR("C0400", Series.PLATFORM, "短信服务异常");
}